<template>
  <div :style="{ '--theme': $store.getters.themeColor }">
    <!--      <el-radio-group v-model="activeName" @change="getActiveName" class="headerBtns">-->
    <!--        <el-radio-button label="0" v-show="tenantId">我的待办</el-radio-button>-->
    <!--        <el-radio-button label="1" v-show="tenantId">我的已办</el-radio-button>-->
    <!--        <el-radio-button label="2">我的收藏</el-radio-button>-->
    <!--      </el-radio-group>-->
    <div class="tabs-wrapper">
      <el-tabs v-model="activeName" type="card" @tab-click="getActiveName">
        <el-tab-pane label="我的待办" v-if="tenantId" name="0"></el-tab-pane>
        <el-tab-pane label="我的已办" v-if="tenantId" name="1"></el-tab-pane>
        <el-tab-pane label="我的收藏" name="2"></el-tab-pane>
      </el-tabs>
    </div>

    <eventManagement
      ref="myToDo"
      :isMyEvent="true"
      :eventWait="'1'"
      v-if="tenantId && activeName === '0'"
      :key="activeName"
    />
    <eventManagement
      :isMyEvent="true"
      :eventWait="'2'"
      v-if="tenantId && activeName === '1'"
      :key="activeName"
    />
    <myFavorites ref="myFavorites" v-if="activeName === '2'" />
  </div>
</template>
<script>
import { trackingMixin } from '@/mixins/trackingMixin.js'
import eventManagement from "@/views/pages/eventManagement/eventManagement";
import myFavorites from "@/views/pages/eventManagement/myFavorites/index";
export default {
  name: "myEvent",
  components: {
    eventManagement,
    myFavorites,
  },
  mixins: [trackingMixin],
  packageInfo: {
    screenData: {
      screenName: '我的事件',
      screenVersion: 'tongyong_wodeshijian_1-6-80_20250514'
    }
  },
  data() {
    return {
      activeName: "0",
      tenantId: "",
    };
  },
  activated() {
    if (this.activeName === "0") {
      this.$nextTick(() => {
        setTimeout(() => {
          this.$refs.myToDo.queryEventData();
        }, 200);
      });
    }
    if (this.tenantId) {
      this.status = this.$route.params.status;
      if (this.status === 0 || this.status === 1) {
        this.activeName = "0";
      } else if (this.status === 2) {
        this.activeName = "1";
      }
    }
  },
  mounted() {
    this.tenantId = this.$store.getters.userInfo.tenantId;
    this.activeName = this.tenantId !== undefined && this.tenantId ? "0" : "2";
  },
  methods: {
    getActiveName(e) {
      this.$nextTick(() => {
        if (e.index == 2) {
          this.$refs.myFavorites.queryEventData();
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
$theme: var(--theme);

.headerBtns {
  margin: 24px 0px 0px 24px;

  /deep/ .el-radio-button .el-radio-button__inner {
    // font-size: 14px;
    color: #333;
    border-color: #dcdfe6;
  }
  /deep/ .el-radio-button:last-child .el-radio-button__inner {
    border-radius: 0px;
  }
  /deep/ .el-radio-button:first-child .el-radio-button__inner {
    border-radius: 0px;
  }
  /deep/ .el-radio-button__orig-radio:checked + .el-radio-button__inner {
    background: #fff;
    color: $theme;
    box-shadow: -1px 0 0 0 #dcdfe6;
  }
}
.tabs-wrapper {
  padding: 24px 24px 0 24px;
}
/deep/.el-tabs__header {
  margin: 0;
}
/deep/.tabs-wrapper .el-tabs__item {
  font-family: PingFangSC !important;
}
::v-deep .has-gutter {
  .cell {
    height: 100%;
    line-height: 40px;
  }
}
</style>
<style lang="scss" scoped src="../index.scss"></style>
